<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:ace="http://www.icefaces.org/icefaces/components"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:icecore="http://www.icefaces.org/icefaces/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:b="http://java.sun.com/jsf/composite/ezcomp"
    template="/resources/templates/template.xhtml">
    
    <ui:define name="title">TallerStudio</ui:define>
   
    <ui:define name="body">
        <h:form id="formBody">
            
             <style type="text/css">
                /* Important required because row */
                .ui-datatable-odd {background-color:lightgray !important;}
            </style>
            
            <ace:panel id="panelcrearrol" header="Mantención de Rol - Creación y Actualización de Roles">
                <h:panelGrid columns="4" style="width: 90%" columnClasses="colwidth25,colwidth1,colwidth20,colwidth40">
                    <h:outputLabel value="Código del rol"/>
                    <h:outputLabel value=":"/>
                    <h:inputText value="#{rolMBean.rol.idRol}" readonly="true"/>
                    <h:panelGroup/>
                    
                    <h:outputLabel value="Nombre del rol"/>
                    <h:outputLabel value=":"/>
                    <h:inputText value="#{rolMBean.rol.rol}" />
                    <h:column>
                        <b:boton value="Limpiar" title="Limpiar" styleClass="flotarIzquierda" action="#{rolMBean.limpiar}"/>
                        <b:boton value="Guardar Cambios" title="Guardar Cambios" styleClass="flotarDerecha" action="#{rolMBean.guardar}"/>
                    </h:column>
                </h:panelGrid>
            </ace:panel>
            <br/>
           <ace:dataTable id="rolTable"
                          value="#{rolMBean.roles}"
                          var="ro"
                          paginator="true"
                          rows="10"
                          paginatorPosition="bottom"
                          emptyMessage="NO ESPECIFICADO"
                          rowIndexVar="index">
               <ace:column id="idcargo" headerText="Código" filterBy="#{ro.idRol}" filterMatchMode="contains" sortBy="#{ro.idRol}">
                   <h:outputText id="idCargoCell" value="#{ro.idRol}"/>
                </ace:column>
               <ace:column id="name" headerText="Nombre del Rol" filterBy="#{ro.rol}" filterMatchMode="contains" sortBy="#{ro.rol}">
                    <h:outputText id="nameCell" value="#{ro.rol}"/>
                </ace:column>
               <ace:column id="accion" headerText="Acciones">
                    <ace:excludeFromExport />
                    <h:commandButton action="#{rolMBean.irEditar}" image="resources/images/edit.gif" title="Editar" >
                        <f:param name="codigo" value="#{ro.idRol}"/>
                            <f:param name="index" value="#{index}"/>
                        </h:commandButton>
                    <h:commandButton action="#{rolMBean.delete}" image="resources/images/delete.gif" title="Eliminar">
                        <f:param name="codigo" value="#{ro.idRol}"/>
                        </h:commandButton>
                     <h:commandButton action="#{rolMBean.irPermisos}" image="resources/images/Lock.png" title="Permisos" >
                         <f:param name="codigo" value="#{ro.idRol}"/>
                            <f:param name="index" value="#{index}"/>
                        </h:commandButton>
                </ace:column>
            </ace:dataTable>
         </h:form>
    </ui:define>

</ui:composition>